package com.shf.entity;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.io.Serializable;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * (Orders)实体类
 *
 * @author makejava
 * @since 2023-10-11 11:28:31
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Alias("Orders")
public class Orders  implements Serializable{


    private String id;

    private String orderNum;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date orderTime;
    /**时间文本*/
    private String orderTimeStr;

    private Integer peopleCount;

    private String orderDesc;

    private Integer payType;
    /**支付状态文本*/
    private String payTypeStr;

    private Integer orderStatus;
    /**订单状态文本*/
    private String orderStatusStr;

    private Product product;
    private List<OrderTraveller> orderTravellers;
    private Member member;
    /**游客数组*/
    private String[]  travellerId;


    public String getOrderTimeStr() {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
         orderTimeStr = dateFormat.format(orderTime);
        return orderTimeStr;
    }

    public String getPayTypeStr() {
        if (payType == 0){
            payTypeStr = "支付宝";
        }else if (payType == 1){
            payTypeStr = "微信";
        }else if (payType == 2){
            payTypeStr ="其他";
        }
        return payTypeStr;
    }

    public String getOrderStatusStr() {

        if (orderStatus == 0){
            orderStatusStr = "未支付";
        }
        if (orderStatus == 1){
            orderStatusStr ="已支付";
        }
        if (orderStatus == null){
            orderStatusStr = "";
        }
        return orderStatusStr;
    }

}

